/**
 * 
 */
package com.tvshows.structure.log;

import java.util.ArrayList;

import org.apache.log4j.Logger;

/**
 * @author Tangi Midy
 */
public class LoggingTreatment
{

    private final ArrayList<String> logMessages;

    private static LoggingTreatment logging;


    /**
     * Constructeur
     */
    private LoggingTreatment()
    {
        logMessages = new ArrayList<String>();

    }

    /**
     * Logs a message
     * 
     * @param text text of the message
     */
    public void log( String text )
    {
        logMessages.add( text );
    }

    /**
     * @param logger the context logger
     * @param message the message to log
     */
    public void logDebug( Logger logger, String message )
    {
        logger.debug( message );
        log( message );
    }

    /**
     * @param logger the context logger
     * @param message the message to log
     */
    public void logInfo( Logger logger, String message )
    {
        logger.info( message );
        log( message );
    }

    /**
     * @param logger the context logger
     * @param message the message to log
     */
    public void logError( Logger logger, String message )
    {
        logger.error( message );
        log( message );
    }

    /**
     * @return the logMessages
     */
    public ArrayList<String> getLogMessages()
    {
        return logMessages;
    }

    /**
     * @return the instance
     */
    public static LoggingTreatment getInstance()
    {
        if ( logging == null )
        {
            logging = new LoggingTreatment();
        }
        return logging;
    }





}
